﻿using BCCommon.Enums;
using BCEntity.Sim.Admin.Admin;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.Admin
{
    /// <summary>
    /// 员工信息
    /// </summary>
    public interface IAdminData
    {
        /// <summary>
        /// 根据用户名校验员工信息是否存在
        /// </summary>
        /// <param name="loginName">员工用户名</param>
        /// <returns></returns>
        Task<bool> CheckAdminExists(string loginName);
        /// <summary>
        /// 根据员工Id校验员工信息是否存在
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<bool> CheckAdminExists(long adminId);

        /// <summary>
        /// 新创建一个员工信息
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        /// <returns></returns>
        Task<AdminEntity> Add(AdminEntity adminEntity);
        /// <summary>
        /// 修改员工信息
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        /// <returns></returns>
        Task<AdminEntity> Update(AdminEntity adminEntity);
        /// <summary>
        /// 根据员工Id获取员工信息
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<AdminEntity> GetAdmin(long adminId);
        /// <summary>
        /// 根据员工名称获取员工信息
        /// </summary>
        /// <param name="loginName">员工名称</param>
        /// <returns></returns>
        Task<AdminEntity> GetAdmin(string loginName);
        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <param name="jobDutyKey">职务</param>
        /// <param name="jobTitleKey">职位</param>
        /// <returns></returns>
        Task<IEnumerable<AdminEntity>> GetAdmins(long? adminId, int? companyId, int? departmentId, string jobDutyKey, string jobTitleKey);
        /// <summary>
        /// 分页查询员工列表信息
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <param name="loginName">员工登录名</param>
        /// <param name="fullName">员工姓名</param>
        /// <param name="accountStatus">账号状态</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">是否按照顺序排序</param>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <returns></returns>
        Task<(IEnumerable<AdminEntity>, int)> GetAdmins(int? companyId, int? departmentId, string loginName, string fullName, AccountStatus? accountStatus, string sortName, bool? ascending, int pageIndex = 1, int pageSize = 10);
        /// <summary>
        /// 获取员工列表（带有各公司负责人）
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<AdminEntity>> GetAdminsForCompany();
        /// <summary>
        /// 更新员工登录信息
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        void UpdateAdminLogonInfo(AdminEntity adminEntity);
        /// <summary>
        /// 更新员工姓名和密码
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        /// <returns></returns>
        Task<bool> UpdateAdminFullNameAndPassword(AdminEntity adminEntity);
        
        /// <summary>
        /// 设置员工的账号状态
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="accountStatus">账号状态</param>
        /// <returns></returns>
        Task<AdminEntity> SetAdminAccountStatus(long adminId, AccountStatus accountStatus);
        /// <summary>
        /// 修改部门信息
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <param name="departmentName">部门名称</param>
        /// <param name="companyId">公司Id</param>
        /// <param name="companyName">公司名称</param>
        /// <returns></returns>
        Task<bool> UpdateDepartmentInfo(long adminId, int companyId, string companyName, int departmentId, string departmentName);
        /// <summary>
        /// 员工修改头像
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        /// <returns></returns>
        Task<bool> UpdateAdminAvatar(AdminEntity adminEntity);
        /// <summary>
        /// 修改员工公司Id
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        Task<bool> UpdateAdminCompanyId(long adminId, int companyId);
        /// <summary>
        /// 修改员工岗位和职务
        /// </summary>
        /// <param name="adminEntity">员工信息</param>
        /// <returns></returns>
        Task<bool> UpdateAdminJobTitleAndJobDuty(AdminEntity adminEntity);

        /// <summary>
        /// 修改员工已付保证金金额
        /// </summary>
        /// <param name="adminEntity"></param>
        /// <returns></returns>
        Task<bool> UpdatePaidSecurityAmount(AdminEntity adminEntity);

        /// <summary>
        /// 获取公司全部员工
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        Task<IEnumerable<AdminEntity>> GetCompanyAdminsAsync(int companyId);
        /// <summary>
        /// 根据职位名称Key查询账户信息
        /// </summary>
        /// <param name="jobTitleKey"></param>
        /// <returns></returns>
        Task<IEnumerable<AdminEntity>> GetCompanyAdminsAsync(string jobTitleKey);
        /// <summary>
        /// 获取部门下所有员工Id
        /// </summary>
        /// <param name="departmentIdPath">部门Id路径</param>
        /// <returns></returns>
        Task<IEnumerable<long>> GetByDepartmentIdAsync(string departmentIdPath);
        /// <summary>
        /// 根据代理商id获取admin信息
        /// </summary>
        /// <param name="agentRecordId">代理商id</param>
        /// <returns></returns>
        Task<AdminEntity> GetAdminByAgentRecordId(long agentRecordId);

    }
}
